<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>『 知音培训信息管理平台』</title>
	<script type="text/javascript" src="__PUBLIC__/Resourse/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/Resourse/js/jquery.cookie.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Resourse/themes/default/easyui.css" id="easyuiTheme">
	<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/Resourse/js/changeEasyuiTheme.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Resourse/themes/icon.css">
	<script type="text/javascript" src="__PUBLIC__/Resourse/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Resourse/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Resourse/locale/easyui-lang-zh_CN.js"></script>
	<style type="text/css">
		body {
			margin:0px;
			padding:0px;
			width:100%;
			height:100%;
		}
		.formStyle{  
            margin:0;  
            padding:10px 10px 30px 5px;  
       }  
       .ftitle{  
            font-size:14px;  
            font-weight:bold;  
            padding:5px 0;  
            margin-bottom:10px;  
            border-bottom:1px solid #ccc;  
        }  
       .fitem{  
            margin-bottom:5px;  
       }  
        .fitem label{  
           display:inline-block;  
            width:80px;  
        }
        .formText {
        	width : 200px;
        }  
	</style>
	<script type="text/javascript">
		var flUrl ="";
		var itemUrl="";
		
		$(function() {		
			$("#searchDiv").hide();
			$(window).resize(function(){
				$('#dg').datagrid('resize');
			});
			
			//设置分页控件
			/*
		    var p = $('#dg').datagrid('getPager');  
		    $(p).pagination({  
		        pageSize: 10,//每页显示的记录条数，默认为10   
		        pageList: [5,10,15],//可以设置每页记录条数的列表   
		        beforePageText: '第',//页数文本框前显示的汉字   
		        afterPageText: '页    共 {pages} 页',  
		        displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',  
		        onBeforeRefresh:function(){ 
		            $(this).pagination('loading'); 
		            alert('before refresh'); 
		            $(this).pagination('loaded'); 
		        }*/  
		    //});  
		    
		    $('#dg').datagrid({
		        pageSize: 15,//每页显示的记录条数，默认为10   
		        pageList: [15,20,30],//可以设置每页记录条数的列表   
		        beforePageText: '第',//页数文本框前显示的汉字   
		        afterPageText: '页    共 {pages} 页',  
		        displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',  
		    	onDblClickRow: function(index,row){
			           //var row = $('#dg').datagrid('getSelected');  
			            if (row){  
			               $('#dlgAccount').dialog('open').dialog('setTitle','查看账目');  
			               $('#fmAccount').form('load',row);  
			               disableForm('fmAccount',true);
			               $('#saveBnt').hide();
			           }else{
			        	   $.messager.alert('消息','请选择一个数据项!','info');
			           }  
		    	}
		    });
		});
		
		$(document).ready(function(){	
			var skin = $.cookie('easyuiThemeName');
			if (skin != null && typeof skin != undefined) {
				changeThemeFun(skin);
			}
			//expandAll();		
		});
		
	    function newAccount(){  
	        $('#dlgAccount').dialog('open').dialog('setTitle','新建账目');  
	        //$('#fmAccount').form('load', '__URL__/getNewLsNum');  
	        $('#fmAccount').form('clear');
            disableForm('fmAccount',false);
            $('#saveBnt').show();
	        itemUrl = '__URL__/add'; 
	    }  
	        
       function editAccount(){  
           var row = $('#dg').datagrid('getSelected');  
            if (row){  
               $('#dlgAccount').dialog('open').dialog('setTitle','编辑账目');  
               $('#fmAccount').form('load',row);
               disableForm('fmAccount',false);
               $('#saveBnt').show();
               itemUrl =  '__URL__/save/id/'+row.Id;  
           }else{
        	   $.messager.alert('消息','请选择一个数据项!','info');
           }  
       }
	       
      function reloadDataGrid(){
    	  var flId= $('#ccItem').combotree('getValue');
          if (flId) {
				var queryParams = $('#dg').datagrid('options').queryParams;  
		        queryParams.PARENT_ID = flId;  
		        //重新加载datagrid的数据  
		        $("#dg").datagrid('reload');  
          }else {
        	  $("#dg").datagrid('reload');   
          }
      }
       
      function saveAccount(){  
           $('#fmAccount').form('submit',{  
               	url: itemUrl,  
                onSubmit: function(){  
                   return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');  
                    if (result.success){  
                    	$.messager.alert('消息','操作成功!','info');
                        $('#dlgAccount').dialog('close');      // close the dialog  		
                        //reloadDataGrid();
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.show({  
	                           title: 'Error',  
	                           msg: result.errorMsg  
	                    });  
                    }  
                }  
            });  
      }
      
	function doSearch(){
		$('#dg').datagrid('load',{
			XQ: $('#XQ').combobox('getValue'),
			LB: $('#LB').combobox('getValue'),
			CZLX: $('#CZLX').val(),
			CLR: $('#CLR').val(),
			JE_GREATER: $('#JE_GREATER').val(),
			JE_LESS: $('#JE_LESS').val(),
			CJSJ_START: $('#CJSJ_START').val(),
			CJSJ_END: $('#CJSJ_END').val()
		});
	}
	
	function beforeSearch(){
		$("#searchDiv").toggle();
	}
      
     function destroyAccount(){  
           var rows = $('#dg').datagrid('getSelections');
           var ids = '';
           for(var i=0;i<rows.length;i++){
        	   ids += rows[i].Id + ',';
           }
          ids = ids.substring(0, ids.length-1);//获取所有要删除的ID
            if (rows.length >0){  
                $.messager.confirm('Confirm','确定要删除选中的 ' + rows.length +' 个账目吗?',function(r){  
                   if (r){  
                      $.post('__URL__/del',{id:ids},function(result){  
                            if (result.success){  
                            	//reloadDataGrid();
                            	$.messager.alert('消息','操作成功!','info');
                              	$('#dg').datagrid('reload');    // reload the user data  
                            } else {  
                               $.messager.show({   // show error message  
                                    title: 'Error',  
                                    msg: result.errorMsg  
                                });  
                           }  
                       },'json');  
                    }  
                });  
            }else{
            	 $.messager.alert('消息','请选择一个数据项!','info');
            }  
       }  

	</script>
</head>
<body class="easyui-layout" style="border-width:50px;margin:0">
	<div id="mainPanle"  region="center"  border="false" >
		<table id="dg" class="easyui-datagrid" style="margin:0" 
							data-options="title:'账目信息列表',border:true,striped:true,nowrap:false,fit:true,autoRowHeight:false,rownumbers:true,pagination:true,singleSelect:false,
												loadMsg:'数据加载中请稍后……',  
												pageSize:10,url:'__URL__/getDisplayList',toolbar:'#tb' ">
			<thead>
				<tr>
					<th data-options="field:'checkbox',checkbox:true" id="checkedAll"></th>
					<th data-options="field:'Id',fitColumns: true,hidden:true">Id</th>
					<th data-options="field:'ZM_LS',fitColumns: true,align:'center'">账目流水</th>
					<th data-options="field:'ZM_XQ',fitColumns: true,hidden:true">所属校区</th>
					<th data-options="field:'XQ',fitColumns: true,align:'center'">账目校区</th>
					<th data-options="field:'ZM_XMSM',itColumns: true,hidden:true">账目说明</th>
					<th data-options="field:'ZM_LB',fitColumns: true,hidden:true">账目类别</th>
					<th data-options="field:'LB',fitColumns: true,align:'center'">账目类别</th>
					<th data-options="field:'ZM_JE',itColumns: true,align:'center'">金额</th>
					<th data-options="field:'ZM_CZLX',fitColumns: true,hidden:true">操作类型</th>
					<th data-options="field:'CZLX',fitColumns: true,align:'center'">操作类型</th>
					<th data-options="field:'ZM_CLR',itColumns: true,hidden:true">处理人</th>
					<th data-options="field:'CLR',itColumns: true,align:'center'">处理人</th>
					<th data-options="field:'ZM_CLSJ',itColumns: true,align:'center'">处理时间</th>
					<th data-options="field:'status',itColumns: true,width:80,align:'center',formatter:function(value,rowData,rowIndex){ if(value == '1'){ return '活跃'} else { return '冻结'}}">数据状态</th>
					<th data-options="field:'ZM_BZ',itColumns: true,align:'center'">备注</th>
				</tr>
			</thead>
		</table>
		<div id="tb" style="padding:5px;height:auto">
			<div style="margin-bottom:5px" >
			 	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newAccount()">添加账目</a>
				<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editAccount()">编辑账目</a> 
				<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyAccount()">删除账目</a>  
				<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="beforeSearch()">检索</a>  
			</div>
			<div id="searchDiv">
		    	<div style="margin-bottom:3px;">  
		        	<label>校&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区: </label>
		        		<input class="easyui-combobox" id="XQ" name="XQ" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList/flValue/XQ'">
		        	<label>账目类别:</label> <input class="easyui-combobox" id="LB" name="LB" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList/flValue/ZMLB'"> 
		        	<label>操作类型:</label> <input class="easyui-combobox" id="CZLX" name="CZLX" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList/flValue/ZMCZLX'"> 
		    		<label>处理人:</label><input id="CLR" name="BJMC" class="easyui-validatebox" >  
		    	</div> 
		    	<div>
		        	<label>金额大于:</label><input id="JE_GREATER" name="JE_GREATER"  class="easyui-numberbox" value="" data-options="precision:2,decimalSeparator:'.'"></input>    
		        	<label>金额小于:</label><input id="JE_LESS" name="JE_LESS"  class="easyui-numberbox" value="" data-options="precision:2,decimalSeparator:'.'"></input>    	
		        	<label>创建时间:</label><input id="CJSJ_START" name="CJSJ_START" class="easyui-datetimebox" >    
		        	<label>至:</label><input id="CJSJ_END" name="CJSJ_END" class="easyui-datetimebox" >    		        	        		        	
		        	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="doSearch()">Search</a>  
		    	</div> 
	    	</div>
	    	
		</div>
	</div>

    <div id="dlgAccount" class="easyui-dialog" style="width:400px;height:390px;padding:10px 20px"  closed="true" 
    		data-options="iconCls:'icon-save',resizable:false,modal:true"  buttons="#dlgAccount-buttons">  
        <div class="ftitle">账目信息</div>  
        <form id="fmAccount" class="formStyle"  method="post" novalidate>
            <div class="fitem">  
                <label>所属校区:</label> 
                <input name="id"  type="hidden">
				<input class="easyui-combobox" id="ZM_XQ" name="ZM_XQ" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList/flValue/XQ'">
            </div>    
            <div class="fitem">  
                <label>账目说明:</label>  
                <input name="ZM_XMSM" class="easyui-validatebox" data-options="required:true">  
            </div>  
            <div class="fitem">  
                <label>账目类别:</label>  
               	<input class="easyui-combobox" id="ZM_LB" name="ZM_LB" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList/flValue/ZMLB'">
            </div>
            <div class="fitem">  
                <label>金额:</label>  
                <input name="ZM_JE"  class="easyui-numberbox" value="0.00" data-options="precision:2,groupSeparator:',',decimalSeparator:'.',prefix:'￥'"></input>
            </div>
            <div class="fitem">  
                <label>操作类型:</label>  
                <input class="easyui-combobox" id="ZM_CZLX" name="ZM_CZLX" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList/flValue/ZMCZLX'">
            </div>    
            <div class="fitem">  
                <label>备注:</label>  
                <textarea name="ZM_BZ" style="height:60px;"></textarea>
            </div>     
        </form>  
    </div>  
    <div id="dlgAccount-buttons">  
        <a id="saveBnt" href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveAccount()">保存</a>  
       	<a id="cancelBnt" href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgAccount').dialog('close')">取消</a>  
    </div> 
</body>
</html>